package com.longxi.tianjintianbao.ui.presenter.complaint;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.activity.complaint.ComplaintDetailActivity;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.base.BaseDialogFragment;
import com.longxi.tianjintianbao.ui.base.BasePresenter;
import com.longxi.tianjintianbao.ui.view.complaint.IComplaintDealDfgView;
import com.longxi.tianjintianbao.utils.MyUtils;

import me.drakeet.multitype.Items;
import me.drakeet.multitype.MultiTypeAdapter;

public class ComplaintDealDfgPresenter extends BasePresenter<IComplaintDealDfgView> {

    private MultiTypeAdapter adapter;
    private Items items;

    private String type = "0";

    public ComplaintDealDfgPresenter(BaseActivity context, BaseDialogFragment dialogFragment) {
        super(context, dialogFragment);
    }

    public void setBar() {
        mDialogFragment.setTitle("处理结果");
        mDialogFragment.setTvLeft("返回");
        getView().getEtContent().setHint("请填写处理结果");
    }

    ComplaintDetailActivity taskDetailActivity;
    /**
     * 获取父类
     * @return
     */
    public ComplaintDetailActivity getComplaintDetailActivity(){
        if(taskDetailActivity == null){
            return (ComplaintDetailActivity) mContext;
        }else{
            return taskDetailActivity;
        }
    }

    public void acceptTask(){
        String content = getView().getEtContent().getText().toString().trim();
        if("".equals(content)){
            MyUtils.showToast("请填写处理结果");
            return;
        }
        getComplaintDetailActivity().saveComplaint(type, content);
    }

    public void getDealType(int i){
        switch (i) {
            case R.id.rBtnPhone:
                type = "0";
                break;
            case R.id.rBtnComeOn:
                type = "1";
                break;
        }
    }


}
